<template>
  <div>
    <el-button type="primary" @click="addTeacher">添加老师</el-button>
    <!---<el-table
      :data="teachers"
      style="width: 100%"> -->
      <el-table
      :data="teachers"
      >
      <el-table-column
        prop="userId"
        label="档案编号"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="称呼"
        width="150">
      </el-table-column>
      <el-table-column
        prop="intro"
        label="个人简介"
        width="280">
      </el-table-column>
      <el-table-column
        prop="resume"
        label="简历"
        width="180">
        <template slot-scope="scope">
          <el-button size="mini" type="primary"  @click="handleEdit(scope.row)">查看</el-button>
          <el-button size="mini" type="primary"  >上传<i class="el-icon-upload el-icon--right"></i></el-button>
        </template>
      </el-table-column>
      <el-table-column
        prop="pic"
        label="老师照片"
        width="180">
        <template slot-scope="scope">
          <el-button size="mini" type="primary"  @click="handleEdit(scope.row)">查看</el-button>
          <el-button size="mini" type="primary"  >上传<i class="el-icon-upload el-icon--right"></i></el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-col :span="24" class="toolbar">
      <el-pagination
        background
        layout="prev, pager, next"
        :page-size="size"
        :total="total"
        :current-page="page"
        @currentPageChange="currentPageChange"
        style="float:right">
      </el-pagination>
    </el-col>
  </div>
</template>

<script>
  import * as courseApi from '../../api/course';
  let sysConfig = require('@/../config/sysConfig');
  export default {
    data() {
      return {
        page: '',
        size: '',
        total: '',
        teachers: [{
          userId: '20160502',
          name: '王小虎',
          intro: '超级讲师',
          resume: '',
          pic: '',
        }, ]
      }
    },
    methods:{
        currentPageChange(val){
          this.page = val;
          this.getTeachers();
        },
        getTeachers(){
           courseApi.findTeachersByCompanyId(this.page,this.size,{}).then((res) => {
              console.log(res);
              if(res.success){
                this.teachers = res.queryResult.list;
                this.total = res.queryResult.total;
              }
           })
        }
    },
    created(){
        this.getTeachers();
    },
    mounted(){
        
    }
  }
</script>
<style>

</style>
